NodeMove Method

Moves a Node object and optionally it's child nodes from one parent  Node object to another Node object in the TreeView control.

Syntax

object.NodeMove(TargetNode, SourceNode, bSelect, eRelationship)

The NodeMove Method syntax has these parts:

Part Description
object Required. An object expression that evaluates to an object in the Applies To list.
TargetNode Required. A valid Node (MSComctlLib.Node) object.
SourceNode Required. A valid Node (MSComctlLib.Node) object.
bSelect Optional. Set selection to parent of Node after delete operation.
eRelationship Optional. A boolean value or constant that specifies the relationship to the TargetNode object, as described in settings.

Settings

The settings for NodeMove Method are:

Setting Description
True Operation was successful.
False Operation failed. (Trap the Err object for error condition)

The settings for IncludeChildren operator are:

Setting Description
True Copy all child Node objects that are associated with SrcNode.
False Copy only the SrcNode.

The settings for eRelationship operator are:

Constant Setting Description
tvwFirst 0 First. The Node is placed before all other nodes at the same level of the node named in relative.
tvwLast 1 Last. The Node is placed after all other nodes at the same level of the node named in relative. Any Node added subsequently may be placed after one added as Last.
tvwNext 2 (Default) Next. The Node is placed after the node named in relative.
tvwPrevious 3 Previous. The Node is placed before the node named in relative.
tvwChild 4 Child. The Node becomes a child node of the node named in relative.

Remarks

This method is used commonly in the drag and Drop operation. 

Can also be used to set a Child node as a Root node by specifiying the TargetNode as an existing Root Node and eRelationship as tvwFirst, tvwLast, tvwNext, or tvwPrevious.